/*
 * @Description: 处理页常用语
 */
import globalMethods from '@/plugins/methods';

export default ({ service, request, tools }) => ({
    /**
     * @description: 常用语获取
     * @param {*}
     * @return {*}
     */
    summaryCommonPhrasesListGet() {
        return request({
            url: `${globalMethods.getLocationOrigin()}/seeyon/ajax.do`,
            method: 'post',
            params: {
                method: 'ajaxAction',
                managerName: 'phraseManager',
                rnd: Math.random(),
            },
            data: 'managerMethod=getAllPhrases&arguments=[]',
        });
    },
    // 选项型常用语
    summaryDynamicPhrasesListGet() {
        return request({
            url: `${globalMethods.getLocationOrigin()}/seeyon/phrase/phrase.do`,
            method: 'get',
            params: {
                method: 'getDynamicList',
                rnd: Date.now(),
                _: Date.now(),
            },
        });
    },
    summaryCommonPhrasesNewAndEditListGet() {
        return request({
            url: `${globalMethods.getLocationOrigin()}/seeyon/ajax.do`,
            method: 'post',
            params: {
                method: 'ajaxAction',
                managerName: 'phraseManager',
                rnd: Math.random(),
            },
            data: 'managerMethod=getPersonPhrases&arguments=[]',
        });
    },
    summaryCommonPhrasesAddOrUpdate(id, str) {
        return request({
            url: `${globalMethods.getLocationOrigin()}/seeyon/ajax.do`,
            method: 'post',
            params: {
                method: 'ajaxAction',
                managerName: 'phraseManager',
                rnd: Math.random(),
            },
            data: `managerMethod=addorupdatePersonPhrase&arguments=[{"id":"${id}","content":"${str}"}]`,
        });
    },
    summaryCommonPhrasesDelete(id) {
        return request({
            url: `${globalMethods.getLocationOrigin()}/seeyon/ajax.do`,
            method: 'post',
            params: {
                method: 'ajaxAction',
                managerName: 'phraseManager',
                rnd: Math.random(),
            },
            data: `managerMethod=deletePersonPhrase&arguments=["${id}"]`,
        });
    },
});
